
	tips = $(".validateTips");

	//给出提示的函数
	function updateeditTips(t) {
		tips.text(t).addClass('ui-state-highlight');
		setTimeout(function() {
			tips.removeClass('ui-state-highlight', 1500);
		}, 500);
	};
$(document).ready(function () {	
	init();
	//findAllMackupByEId();
	$('#mackup_down').click(function () {
		$('#mackup_down').hide();
		$('#mackup_up').show();
		$("#mackups").show();
	});
	$('#mackup_up').click(function () {
		$('#mackup_up').hide();
		$('#mackup_down').show();
		$("#mackups").hide();
	});
	//$("#eventUpGradeDiv").dialog("open");
	//$("#eventUpGradeAuditDiv").dialog("open");
	
	$("#eventUpGradeButton").click(function (){
		$("#eventUpGradeDiv").dialog("open");
	});
	
	$("#eventUpGradeAuditButton").click(function (){
		$("#eventUpGradeAuditDiv").dialog("open");
	});
});	
function init() {
	$("#eventUpGradeDiv").dialog({
		autoOpen : false,
		//height : '200',
		width : '400',
		modal : true,
		buttons : {
			'确定' : function() {
				
				var newLevelId = $("#newLevelId option:selected").attr("value");
				//alert(newLevelId);
				var applyContent = $("#applyContent").text();
				//alert(applyContent);
				if(applyContent.length>10)
				{
					updateeditTips("长度不能超过10个单词");
					return false;
				}
				if(applyContent.length==0)
				{
					updateeditTips("内容不能为空");
					return false;
				}
				var url = "/ag/do/eventUpGrade_eventUpGrade.action";
				var req = {"newLevelId":newLevelId,"applyContent":applyContent};
				$.post(url,req,function (data){
					//alert("callback");
					if(data.result === "success") {
						$("#message").append("提交申请成功！");
						
					}else {
						$("#message").append("提交申请失败！");
					}
					$("#message").dialog("open");
				});
				$("#newLevelId option:selected").attr("value","");
				$("#applyContent").empty();
				$("#eventUpGradeDiv").dialog("close");
			},
			'取消' : function() {
				$("#newLevelId option:selected").attr("value","");
				$("#applyContent").empty();
				$("#eventUpGradeDiv").dialog("close");
			}
		},
		close : function() {
				$("#newLevelId option:selected").attr("value","");
				$("#applyContent").empty();
				updateeditTips("");
			}
	});
	$("#eventUpGradeAuditDiv").dialog({
		autoOpen : false,
		//height : '200',
		width : '500',
		modal : true,
		buttons : {
			'确定' : function() {
				var egId = $("#egId").attr("value");
				var egAgree = $("#egAgree").attr("checked");
				var auditContent = $("#auditContent").text();
				//alert(egId);
				//alert(egAgree);
				//alert(auditContent);
				if(auditContent.length>10)
				{
					updateeditTips("长度不能超过10个单词");
					return false;
				}
				if(auditContent.length==0)
				{
					updateeditTips("内容不能为空");
					return false;
				}
				var url = "/ag/do/eventUpGrade_eventGradeAudit.action";
				var req = {"egId":egId,"auditContent":auditContent,"egAgree":egAgree}; 
				$.post(url,req,function (data){
					//alert("callback");
					if(data.result === "success") {
						$("#message").append("提交申请成功！");
						
					}else {
						$("#message").append("提交申请失败！");
					}
					$("#message").dialog("open");
				});
				
				
				$("#eventUpGradeAuditDiv").dialog("close");
			},
			'取消' : function() {
				$("#eventUpGradeDiv").dialog("close");
			}
		},
		close : function() {
			updateeditTips("");
			}
	});
	
	$("#message").dialog({
		autoOpen : false,
		//height : '300',
		width : '500',
		modal : true,
		buttons : {
			'确定' : function() {
				$("#message").dialog("close");
				$("#message").empty();
			}
		},
		close : function() {
			
			}
	});
}
	function findAllMackupByEId(){
		var eid=$("#eid").text();
		$.ajax({
			type: "post",
			data:{'EId':eid},
			url: "wzp/eventMackup_findByEId.action",
			success:function(data){
				$("#mackups").empty();
				var strHTML = "";
				if(data.mackups.length>0){
					$.each(data.mackups,function(i,n){
						var j = i + 1;
						strHTML += "<tr class='trtab'>";
						strHTML += "<td class='tdtab2' colspan='3'>";
						strHTML += "<span style='float: left; padding-top:20;width:104;text-align:right'>事件补充"+j+"：</span>";
						strHTML += "<span class='textAeraRight'>补充人："+n.tbUser.UName+"   补充时间："+n.emTime.replace(/T/," ");
						strHTML += "<span class='textAeraRight'>"+n.emContext+"</span>";
						strHTML += "</span></td></tr>";
					});
				}else{
					strHTML += "<tr class='trtab'>";
					strHTML += "<td class='tdtab' colspan='3'>";
					strHTML += "<span style='padding-left:20'>没有补充内容<span></td></tr>";
				}
				$("#mackups").append(strHTML);
				$("#mackups").show();
			}
		});
	}
